package conf

import "time"

/**
* Author: joker
* TODO: test
* Date: 2022/8/16
* Time: 上午9:32
**/

type system struct {
	Debug       bool   `mapstructure:"debug" yaml:"debug" json:"debug"`
	Port        int    `mapstructure:"port" yaml:"port" json:"port"`
	HashId      string `mapstructure:"hash_id" yaml:"hash_id" json:"hash_id"`
	HashSession string `mapstructure:"hash_session" yaml:"hash_session" json:"hash_session"`
	AppDev      string `mapstructure:"app_dev" json:"app_dev" yaml:"app_dev"`
	AppName     string `mapstructure:"app_name" json:"app_name" yaml:"app_name"`
	AppVersion  string `mapstructure:"app_version" json:"app_version" yaml:"app_version"`
	Tls         bool   `mapstructure:"tls" yaml:"tls" json:"tls"`
}

type zapConfig struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"`
	Format        string `mapstructure:"format" json:"format" yaml:"format"`
	Director      string `mapstructure:"director" json:"director"  yaml:"director"`
	LinkName      string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
	EncodeLevel   string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
	LogInConsole  bool   `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
}

type mysql struct {
	IsUse           bool          `mapstructure:"is_use" yaml:"is_use" json:"is_use"`
	User            string        `mapstructure:"user" yaml:"user" json:"user"`
	Password        string        `mapstructure:"password" yaml:"password" json:"password"`
	Host            string        `mapstructure:"host" yaml:"host" json:"host"`
	Port            int           `mapstructure:"port" yaml:"port" json:"port"`
	DbName          string        `mapstructure:"db_name" yaml:"db_name" json:"db_name"`
	Params          string        `mapstructure:"params" yaml:"params" json:"params"`
	TablePrefix     string        `mapstructure:"table_prefix" yaml:"table_prefix" json:"table_prefix"`
	ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime" yaml:"conn_max_lifetime" json:"conn_max_lifetime"`
	MaxOpenConns    int           `mapstructure:"max_open_conns" yaml:"max_open_conns" json:"max_open_conns"`
	MaxIdleConns    int           `mapstructure:"max_idle_conns" yaml:"max_idle_conns" json:"max_idle_conns"`
}

type redis struct {
	IsUse    bool   `mapstructure:"is_use" yaml:"is_use" json:"is_use"`
	Password string `mapstructure:"password" yaml:"password" json:"password"`
	Host     string `mapstructure:"host" yaml:"host" json:"host"`
	Port     int    `mapstructure:"port" yaml:"port" json:"port"`
	DbName   int    `mapstructure:"db_name" yaml:"db_name" json:"db_name"`
}

type grpc struct {
	IsUse     bool          `mapstructure:"is_use" yaml:"is_use" json:"is_use"`
	Host      string        `mapstructure:"host" yaml:"host" json:"host"`
	Port      int           `mapstructure:"port" yaml:"port" json:"port"`
	Timeout   time.Duration `mapstructure:"timeout" yaml:"timeout" json:"timeout"`
	NotifyUrl string        `mapstructure:"notify_url" yaml:"notify_url" json:"notify_url"`
}

type googleHome struct {
	ClientId string `mapstructure:"client_id" yaml:"client_id" json:"client_id"`
	Secret   string `mapstructure:"secret" yaml:"secret" json:"secret"`
}

type oauth2 struct {
	OauthServer string `mapstructure:"oauth_server" yaml:"oauth_server" json:"oauth_server"`
	DcLoginLink string `mapstructure:"dc_login_link" yaml:"dc_login_link" json:"dc_login_link"`
}

type jwtConfig struct {
	KeyId     string `mapstructure:"key_id" yaml:"key_id" json:"key_id"`
	KeySecret string `mapstructure:"key_secret" yaml:"key_secret" json:"key_secret"`
}

type wechat struct {
	Appid     string `mapstructure:"appid" yaml:"appid" json:"appid"`
	AppSecret string `mapstructure:"app_secret" yaml:"app_secret" json:"app_secret"`
}

type jiachao struct {
	AuthApi string `mapstructure:"auth_api" yaml:"auth_api" json:"auth_api"`
	AuthKey string `mapstructure:"auth_key" yaml:"auth_key" json:"auth_key"`
}

type aliPay struct {
	AppID                    string `mapstructure:"app_id" yaml:"app_id" json:"app_id"`
	PrivateKey               string `mapstructure:"private_key" yaml:"private_key" json:"private_key"`
	IsProduction             bool   `mapstructure:"is_production" yaml:"is_production" json:"is_production"`
	AppCertPublicKey         string `mapstructure:"app_cert_public_key" yaml:"app_cert_public_key" json:"app_cert_public_key"`
	AlipayRootCert           string `mapstructure:"alipay_root_cert" yaml:"alipay_root_cert" json:"alipay_root_cert"`
	AlipayCertPublicKey_RSA2 string `mapstructure:"alipay_cert_public_key_rsa_2" yaml:"alipay_cert_public_key_rsa_2" json:"alipay_cert_public_key_rsa_2"`
	NotifyUrl                string `mapstructure:"notify_url" yaml:"notify_url"  json:"notify_url"`
}

type wechatPay struct {
	MchID                      string `mapstructure:"mch_id" yaml:"mch_id" json:"mch_id"`
	MchCertificateSerialNumber string `mapstructure:"mch_certificate_serial_number" yaml:"mch_certificate_serial_number" json:"mch_certificate_serial_number"`
	MchAPIv3Key                string `mapstructure:"mch_ap_iv_3_key" yaml:"mch_ap_iv_3_key" json:"mch_ap_iv_3_key"`
	PrivateKeyPath             string `mapstructure:"private_key_path" yaml:"private_key_path" json:"private_key_path"`
	Appid                      string `mapstructure:"appid" yaml:"appid" json:"appid"`
	NotifyUrl                  string `mapstructure:"notify_url" yaml:"notify_url"  json:"notify_url"`
}

type rabbitMq struct {
	IsUse bool   `mapstructure:"is_use" yaml:"is_use" json:"is_use"`
	Dns   string `mapstructure:"dns" yaml:"dns" json:"dns"`
}

type config struct {
	System     system     `mapstructure:"system" yaml:"system" json:"system"`
	Zap        zapConfig  `mapstructure:"zap" yaml:"zap" json:"zap"`
	Mysql      mysql      `mapstructure:"mysql" yaml:"mysql" json:"mysql"`
	Redis      redis      `mapstructure:"redis" yaml:"redis" json:"redis"`
	GoogleHome googleHome `mapstructure:"google_home" yaml:"google_home" json:"google_homegoogle_home"`
	Oauth2     oauth2     `mapstructure:"oauth2" yaml:"oauth2" json:"oauth2"`
	JwtConfig  jwtConfig  `mapstructure:"jwt_config" yaml:"jwt_config" json:"jwt_config"`
	Grpc       grpc       `mapstructure:"grpc" yaml:"grpc" json:"grpc"`
	Wechat     wechat     `mapstructure:"wechat" yaml:"wechat" json:"wechat"`
	Jiachao    jiachao    `mapstructure:"jiachao" yaml:"jiachao" json:"jiachao"`
	AliPay     aliPay     `mapstructure:"ali_pay" yaml:"ali_pay" json:"ali_pay"`
	WechatPay  wechatPay  `mapstructure:"wechat_pay" yaml:"wechat_pay" json:"wechat_pay"`
	RabbitMq   rabbitMq   `mapstructure:"rabbit_mq" yaml:"rabbit_mq" json:"rabbit_mq"`
}

var Config = config{}
